import http from '@/utils/http.js'
const SERVICE_NAME="/car-service";

//加入购物车
export function saveToCar(data){
	return http.post(SERVICE_NAME+"/car/insert",data);
}

//查看购物车
export function queryCar(){
	return http.get(SERVICE_NAME+"/car/select");
}

//更新商品数量 
export function updateNum(data){
	return http.put(SERVICE_NAME+"/car/updatenumber",data);
}

//更新选中状态
export function updateSel(skuId){
	return http.put(SERVICE_NAME+"/car/ischecked?skuId="+skuId)
}


// 删除商品（修正模板字符串）
export function deleteItem(skuId) {
  return http.delete(`${SERVICE_NAME}/car/delete/${skuId}`);
}

//获取购物车商品数量
export function getItemNum(){
  return http.get(SERVICE_NAME+"/car/skunum");
}

//全选
export function allChecked(number){
	return http.put(`${SERVICE_NAME}/car/allischecked/${number}`)
}
